//package com.punch.order.service.impl;
//
//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
//import com.punch.order.mapper.CourseOrderMapper;
//import com.punch.order.mapper.MaterialOrderMapper;
//import com.punch.order.mapper.OrderMapper;
//import com.punch.order.mapper.OrderRecordLogMapper;
//import com.punch.order.model.OrderCourseSnapshot;
//import com.punch.order.model.MaterialOrder;
//import com.punch.order.model.Order;
//import com.punch.order.model.OrderRecordLog;
//import com.punch.order.service.OrderRecordLogService;
//import org.springframework.stereotype.Service;
//
//import javax.annotation.Resource;
//
///**
// * OrderRecordLogServiceImpl
// *
// * @author xiaol
// * @version 1.0.0
// * @since 2020/8/8
// */
//@Service
//public class OrderRecordLogServiceImpl extends ServiceImpl<OrderRecordLogMapper, OrderRecordLog> implements OrderRecordLogService {
//
//    @Resource
//    private OrderMapper orderMapper;
//
//    @Resource
//    private CourseOrderMapper courseOrderMapper;
//
//    @Resource
//    private MaterialOrderMapper materialOrderMapper;
//
//    @Override
//    public void saveOrderOperateLog(Long orderId, Long courseOrderId, Long materialOrderId, String optRemarks, String infoRemarks) {
//        Order order = orderMapper.selectById(orderId);
//        OrderRecordLog orderRecordLog = new OrderRecordLog();
//        //主订单
//        orderRecordLog.setCreateId(order.getCreateId());
//        orderRecordLog.setOptOrderId(order.getId());
//        orderRecordLog.setOptOrderNo(order.getOrderNo());
//        orderRecordLog.setOptType(0);
//        orderRecordLog.setOrderStatus(order.getOrderStatus());
//        orderRecordLog.setOptTime(order.getCreateTime());
//        orderRecordLog.setOptAmountFee(order.getTotalFee());
//        orderRecordLog.setOptRemark(optRemarks);
//        orderRecordLog.setInfoRemark(infoRemarks);
//        save(orderRecordLog);
//        //课程订单
//        OrderCourseSnapshot orderCourseSnapshot = courseOrderMapper.selectById(courseOrderId);
//        orderRecordLog = new OrderRecordLog();
//        orderRecordLog.setCreateId(order.getCreateId());
//        orderRecordLog.setOptOrderId(orderCourseSnapshot.getId());
//        orderRecordLog.setOptOrderNo(orderCourseSnapshot.getOrderNo());
//        orderRecordLog.setOptType(1);
//        orderRecordLog.setOrderStatus(order.getOrderStatus());
//        orderRecordLog.setOptTime(orderCourseSnapshot.getCreateTime());
//        orderRecordLog.setOptAmountFee(orderCourseSnapshot.getCourseTotalFee());
//        orderRecordLog.setOptRemark(optRemarks);
//        orderRecordLog.setInfoRemark("");
//        save(orderRecordLog);
//        //教具订单
//        if (order.getContainMaterialFlag() == 1 && materialOrderId.intValue() != 0) {
//            MaterialOrder materialOrder = materialOrderMapper.selectById(materialOrderId);
//            orderRecordLog = new OrderRecordLog();
//            orderRecordLog.setCreateId(order.getCreateId());
//            orderRecordLog.setOptOrderId(materialOrder.getId());
//            orderRecordLog.setOptOrderNo(materialOrder.getOrderNo());
//            orderRecordLog.setOptType(2);
//            orderRecordLog.setOrderStatus(order.getOrderStatus());
//            orderRecordLog.setOptTime(materialOrder.getCreateTime());
//            orderRecordLog.setOptAmountFee(materialOrder.getMaterialOrderFee());
//            orderRecordLog.setOptRemark(optRemarks);
//            orderRecordLog.setInfoRemark("");
//            save(orderRecordLog);
//        }
//    }
//
//}
